﻿<!--#include file="../../inc/common.asp" -->
<%
'显示Blog文章内容及其评论、引用的功能模块，
'同时提供发表评论和提交引用的输入域
'
'author: evan zhao
'

  dim content_id, blogItem, count, i
  content_id = trim(request("content_id"))
  if content_id="" then
    message("文章不存在")
    return
  end if
  
  content_id=clng(content_id)
  
  set blogItem = new BlogItemClass    
  
  if  blogItem.load(content_id) = false then
    message("文章不存在")
    call closeDB()
    response.end
  end if
  
  'response.AddHeader "Last-Modified", DateToGMT(blogItem.updateTime)
  'response.Expires = 0
  'response.CacheControl = "no-cache"
%>

<HTML><HEAD><TITLE><%=blogObj.blogTitle%><%
    if blogCatObj.catName<>"" then
        response.write(" -" & blogCatObj.catName)
    end if
%>-<%=blogItem.title%>
</TITLE>
<META http-equiv=Content-Type content="text/html; charset=<%=DEFAULT_CHARSET%>">
<% 
if not isNull(blogItem.excerpt) then
%>
<META Name="description" Content="<%=replace(blogItem.excerpt,"""","&quot;")%>">
<%
 end if
%>
<link rel="stylesheet" href="styles.css" type="text/css" />
<script language=javascript>
    var isIE = false
    if (document.all){
        isIE = true;
    }

    function RTELoaded(editor){
        if (editor==commentEditor){
            if (form1.detail.value!=""){
                editor.setHTML(form1.detail.value);
            }
        }
        
    }
    function replyComment(comment_id){
        theform = document.getElementById("form1");
        theform.action="comment.asp"
        theform.actionType.value="";
        theform.parent_id.value=comment_id;
        theform.submit();
    }
    function editComment(comment_id){
        theform = document.getElementById("form1");
        theform.action="comment.asp"
        theform.actionType.value="";
        theform.comment_id.value=comment_id;
        theform.submit();
    }
    function deleteComment(comment_id){
        if (!confirm("确定删除吗？")){
            return false;
        }
        theform = document.getElementById("form1");
        theform.actionType.value="doDelete";
        theform.comment_id.value=comment_id;
        theform.submit();
    }
    function saveReply(){
        theform = document.getElementById("form1");
        if (isIE){
            if(commentEditor.getText()!=""){
                theform.detail.value = commentEditor.getHTML();
            }else{
                theform.detail.value = "";
            }
        }
        if (theform.detail.value==""){
            alert("请输入回复内容")
            return;
        }
        theform.actionType.value="doSave";
        theform.submit();
    }
    function saveTrack(){
        theform = document.getElementById("form2");
        if (theform.url.value==""){
            alert("请输入文章URL")
            return;
        }
        theform.actionType.value="doSave";
        theform.submit();
    }
    function deleteTrack(track_id){
        if (!confirm("确定删除吗？")){
            return false;
        }
        theform = document.getElementById("form2");
        theform.actionType.value="doDelete";
        theform.track_id.value=track_id;
        theform.submit();
    }
</script>
<style type="text/css">

BUTTON {
    border:1px dotted #98ccd0;background-color:#ffffff;font-family:verdana;font-size:9pt;height:18px;color: #346784;
}

</style>
<script id=clientEventHandlersJS language=javascript>
<!--

//-->
</script>
</HEAD>
<BODY>
<center>
<DIV id=container style=" width:80%; background-color:transparent" align=center>
    <DIV id=banner>
        <h1><a href="index.asp?blog_id=<%=blogObj.blogId%>"><%=blogObj.blogTitle%></a>
<%
    if blogCatObj.catName<>"" then
%>
    -<a href="index.asp?blog_id=<%=blogCatObj.blogId%>&cat_id=<%=blogCatObj.catId%>"><%=blogCatObj.catName%></a>
<%
    end if
%></h1>
        <h2><%=filterHTML(blogObj.blogDesc)%></h2>
     
    </DIV>
    <br>
    <div class=content style="  background-color:#ffffff; width:100%">  

           <div style="float:right">
                <a href="detail.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=content_id%>&pageno=<%=request("pageno")%>&lang=default">默认</a>
                <a href="detail.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=content_id%>&pageno=<%=request("pageno")%>&lang=zh_CN">简体</a>
                <a href="detail.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=content_id%>&pageno=<%=request("pageno")%>&lang=zh_TW">繁體</a>
								<br><br>
								<script type="text/javascript"><!--
								google_ad_client = "pub-3281958449223466";
								google_ad_width = 120;
								google_ad_height = 240;
								google_ad_format = "120x240_as";
								google_ad_channel ="";
								google_color_border = "B0E0E6";
								google_color_bg = "FFFFFF";
								google_color_link = "000000";
								google_color_url = "336699";
								google_color_text = "333333";
								//--></script>
								<!--script type="text/javascript"
								  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
								</script-->
           </div>
         
        <%
        dim  start_date_str, end_date_str, insert_time_str
        start_date_str = FORMATDATETIME(blogItem.startDate, vbShortDate)
        end_date_str = FORMATDATETIME(blogItem.endDate, vbShortDate)
        insert_time_str = FORMATDATETIME(blogItem.insertTime, vbShortDate)
        %>  
            <h2>
        <%
            if start_date_str = insert_time_str and end_date_str = insert_time_str then
                response.write (insert_time_str)
            elseif  start_date_str =  end_date_str then
                response.write (end_date_str)
            else
                response.write (start_date_str & " ~ " & end_date_str)
            end if     
        %>
            </h2>
            <h3><%=blogItem.title%></h3>
            <div>
        <%
            if not isNull(blogItem.face) and not isEmpty(blogItem.face) and blogItem.face<>"" then
                response.write("<img src='" & blogItem.face & "'  style='float:left;padding-right:10px;padding-bottom:10px' onerror='this.width=0;height=0;this.style.display=""block""' onload='if (this.width>122){this.height=this.height*122/this.width;this.width=122;} '>")
            end if
            if blogItem.isSecret then 
                response.write("<p>--保密内容--</p>")
            end if
            if userRightObj.canReadItem(blogItem) then
                response.write("<p>"& blogItem.excerpt & "</p>")            
                response.write(blogItem.detail)
                if not isNull(blogItem.more) and not isEmpty(blogItem.more) then
                    response.write("<a name=more></a><br>")
                    response.write(blogItem.more)
                end if
            end if    
        %>
            </div>
            <div align="right" class="posted">
                <%
                    if blogItem.userId="" or blogItem.userId=0 then
                        response.write blogItem.userName
                     else
                %>     
                     <a href=user.asp?user_id=<%=blogItem.userId%>&blog_id=<%=blogItem.blogId%>&cat_id=<%=blogItem.catId%>&pageno=<%=request("pageno")%>><%= blogItem.userName%></a>
                <%
                     end if                
                %>&nbsp;
              <%
                if start_date_str = insert_time_str and end_date_str = insert_time_str then
                    response.write FORMATDATETIME(blogItem.insertTime,vbLongTime)
                else
                    response.write blogItem.insertTime
                end if
              %>&nbsp;
                <% if userRightObj.canEditItem(blogItem) then %>| <a href=edit.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=request("pageno")%>> 编辑</a> <% end if  %> 
                <% if userRightObj.canDeleteItem(blogItem)  then %>| <a href="#" onclick="javascript:if (confirm('确认删除吗？')){document.location.href='delete.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=request("pageno")%>';}" >删除</a> <% end if  %>
                <% if userRightObj.canReplyItem(blogItem)  then %>| <a href="#reply" >回复</a><% end if  %>
               
            </div>    
      
            
            
            <div>
            <a name="tracks"></a> 
        <%
            
              dim track, tracks
              tracks = blogItem.getTracks()
              if isArray(tracks) then
                count = ubound(tracks)
                if count>0 then
                    for i=0 to count-1 
                        set track = tracks(i)
        %>
         		<hr style="height:1px;border-top:0px;border-bottom:1px dashed #cccccc;" />
            <a name="track<%=track.trackId%>"></a> 
            <h2><b>引用：</b><a href=<%=track.url%>><%=track.title%></a></h2>
            <div><%=track.excerpt%></div>
            <div class="posted">
                发布在 <a href=<%=track.hostUrl%>><%=track.hostName%></a>
                <%=track.insertTime%> 
                <%
                    if userRightObj.canDelete or (userObj.userId<>"" and userObj.userId=track.userId) then
                %>
                <!-- a href="#track<%=track.trackId%>" onclick="javascript:deleteTrack(<%=track.trackId%>)">Delete</a-->
                <BUTTON onclick="javascript:deleteTrack(<%=track.trackId%>)" >删除</button>
                <%
                    end if
                %>
            </div>
                        
        <%
                    next
                end if
              end if  
            
            
            dim parentComment
            set parentComment=new BlogCommentClass
            parentComment.commentId=Null
            parentComment.isSecret=False
            
            const MAX_DEEP_LEN = 2

            
            dim last_insert_date
            call writeComments(blogItem.getComments(),parentComment, 0)
            
            sub writeComments(comments, parentComment, deepLen)
              dim comment
              dim insert_date
              dim count, i
            
              if isArray(comments) then
                count = ubound(comments)
            
                if count>0 then
                    for i=0 to count-1
                      if not isEmpty(comments(i)) then
                        set  comment =  comments(i)
                        if comment.parentId=parentComment.commentId or (isNull(comment.parentId) and isNull(parentComment.commentId)) then '嵌套子回复
                          if not isNull(comment.parentId)  and deepLen<=MAX_DEEP_LEN  then
                            response.write "<div  style='margin-left:20px;margin-bottom:10px;background:#f6f6f6;border:1px dotted #cccccc;padding: 10px,10px,10px,10px;'>"
                          else
                    %>              
                                <hr style="height:1px;border-top:0px;border-bottom:1px dashed #cccccc;" />
                    <%
                          end if
        %>
            <a name="comment<%=comment.commentId%>" onclick="return comment<%=comment.commentId%>_onclick()"></a> 
        <%
                insert_date = FORMATDATETIME(comment.insertTime,vbShortDate)          
                if insert_date<> last_insert_date then
        %>
            <h2><%=insert_date%></h2>
        <%
                    last_insert_date = insert_date
                end if
                'response.write comment.parentId & "." &comment.commentId
        %>
            <div>
        <%
                if not isNull(comment.face) and not isEmpty(comment.face) and comment.face<>"" then
                    response.write("<img src='" & comment.face & "' style='clear:both;float:left;padding-right:10px;padding-bottom:10px' onerror='this.width=0;height=0;this.style.display=""block""' onload='if (this.width>122){this.height=this.height*122/this.width;this.width=122;} ' >")
                end if
                if comment.isSecret then
                    response.write("<p>--悄悄话--</p>")
                end if
                'if (not comment.isSecret and not parentComment.isSecret and not blogItem.isSecret) _
                if UserRightObj.canReadComment(comment) then
                    response.write(comment.detail)
                end if    
        %>
            </div>
            <div class="posted">
                <%
                    if comment.userId="" or comment.userId=0 or isNull(comment.userId) then
                        response.write comment.userName
                     else
                %>     
                     <a href=user.asp?user_id=<%=comment.userId%>&blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=request("pageno")%>><%=comment.userName%></a>
                <%
                     end if                
                %>&nbsp;
                <%="<a href=mailto:" & encodemail(comment.email) & ">Email</a>" %>&nbsp;
                <%="<a href=" & comment.webUrl & ">Web</a>" %>&nbsp;
                <%=FORMATDATETIME(comment.insertTime,vbShortTime)%>  
                <%
                    if userRightObj.canReplyComment(comment) then 
                %>
                &nbsp;
                <BUTTON onclick="javascript:replyComment(<%=comment.commentId%>)" >回复</button>
                <%
                    end if
                %>
                <%
                    if (userObj.userId<>"" and userObj.userId=comment.userId) then
                %>
                &nbsp;
                <BUTTON onclick="javascript:editComment(<%=comment.commentId%>)" >编辑</button>
                <%
                    end if
                %>
                <%
                    if userRightObj.canDeleteComment(comment) then
                %>
                <!--a href="#comment<%=comment.commentId%>" onclick="javascript:deleteComment(<%=comment.commentId%>)">Delete</a-->
                &nbsp;
                <BUTTON onclick="javascript:deleteComment(<%=comment.commentId%>)" >删除</button>
                <%
                    end if
                %>
            </div>
        <%
                      set comments(i) = nothing
                      comments(i) = Empty
                      call writeComments(comments, comment,deepLen+1)
                      if not isNull(comment.parentId) and deepLen<=MAX_DEEP_LEN then  '嵌套子回复
                          call writeComments(comments, comment,deepLen+1)
                        response.write "</div>"
                      end if                        
                    end if
                  end if  
                next
            end if
          end if
        end sub
        
        if userRightObj.canReplyItem(blogItem) then
        
        %>
            <div>
            <a name="reply"></a>
            <br>
            <form name="form1" id="form1" method="post" action="reply.asp">
              <input name="actionType" type="hidden"  />
              
              <input name="blog_id" type="hidden" value="<%=blogObj.blogId%>" />
              <input name="cat_id" type="hidden" value="<%=blogCatObj.catId%>" />
              <input name="content_id" type="hidden" value="<%=content_id%>" />
                <input name="parent_id" type="hidden" value="" />
              <input name="comment_id" type="hidden"  />
              <input name="pageno" type="hidden" value="<%=request("pageno")%>" />
            <p>  
              用户名：<%
                if userObj.isFound then
                    response.write "<a href=userinfo.asp?blog_id=" & blogObj.blogId & "&cat_id=" & blogCatObj.catId & "&pageno=" & request("pageno") & ">" & userObj.userName & "</a>"
                else                    
            %><input name="username" type="text" size="20" value="<%=userObj.userName%>" />
              
              &nbsp;密码：<input name="password" type="password" size="20" value="" />（如不登录密码请留空）
              <br />
              Email ：<input name="email"  type="text" size="20" value="<%=userObj.email%>" />
              &nbsp;主页：<input name="web_url" type="text" size="20" value="<%=userObj.webUrl%>" />
              <br />&nbsp;请输入校验码：<input name="check_num" type="text" size="5"  /> 校验码：<img src="check_num.asp">
            <%
                end if
            %>  
            </p>  
              您的回复：<br />
            <script language="javascript">
                document.write('<textarea name=detail rows=12 cols=38');
                if (isIE){
                    document.write (' style="display:none" ');
                }
                document.write('>');
            </script></textarea>
            <script language="javascript">
                if (isIE){
                    document.write('<IFRAME id="commentEditor" Name="commentEditor" style="WIDTH: 500px; HEIGHT: 360px"  SRC="rte/rte.htm"></IFRAME>'); 
                    document.write('<input type=hidden name="use_rte" value="true">');
                }
            </script>

                  <br />
             <% if userObj.userId<>"" then  %>
              <input name="is_secret" type="checkbox" value="true"  <% if blogItem.isSecret then response.write("checked") end if %>   >悄悄话</input>
              <% end if  %> 
              <br />
              <br />
              <input name="submitBtn" type="button" onclick="saveReply()" value="&nbsp;&nbsp;回 复&nbsp;&nbsp;"  />
              <input  type="button" onclick="history.back()" value="&nbsp;&nbsp;后 退&nbsp;&nbsp;"  /> 
              <input  type="button" onclick="document.location.href='index.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=request("pageno")%>'" value="&nbsp;&nbsp;返 回&nbsp;&nbsp;"  />
            </form>        
            </div>
            <%
            else
            %>
            <p align=center>
                            <input  type="button" onclick="history.back()" value="&nbsp;&nbsp;后 退&nbsp;&nbsp;"  /> 
                            <input  type="button" onclick="document.location.href='index.asp?blog_id=<%=blogCatObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=request("pageno")%>'" value="&nbsp;&nbsp;返 回&nbsp;&nbsp;"  />
            </p>
            <%
                end if
            %>            
            <p>&nbsp;</p>
        </div><!--end of content-->

        <p>&nbsp;</p>

  

<div>
<a name="tracks"></a> 
<!-- 由于spam无法阻止，引用功能已禁用
<%

if userRightObj.canReplyItem(blogItem) then

%>

            <a name="trackback"></a>
            <p>本文全文URL：<a href=<%=baseURL%>/detail.asp?blog_id=<%=blogObj.blogId%>&content_id=<%=content_id%>><%=baseURL%>/detail.asp?blog_id=<%=blogObj.blogId%>&content_id=<%=content_id%></a><br>
            本文引用通告(trackback)URL：<input type=text style="border:0" readonly size=72 onmouseover="this.focus()" onfocus="this.select()" value="<%=baseURL%>/tb.asp?cid=<%=content_id%>"></p>
            
            <p>如果您转贴了本文，或者在其他位置发布了与本文内容相关的文章，或者推荐与本文内容相关的文章，<br>请留下该文章的URL及相关信息：</p>
            <form name="form2" id="form2" method="post" action="tracks.asp">
                <input name="actionType" type="hidden" value="doSave" />
                
                <input name="blog_id" type="hidden" value="<%=blogObj.blogId%>" />
                <input name="cat_id" type="hidden" value="<%=blogCatObj.catId%>" />
                <input name="content_id" type="hidden" value="<%=content_id%>" />
                <input name="track_id" type="hidden"  />
                <input name="pageno" type="hidden" value="<%=request("pageno")%>" />
               
                URL： <br />
                <input name="url" type="text" size="38" value="http://" /> <font color=red>*</font>
                <br />
                文章标题： <br />
                <input name="title"  type="text" size="38" /><br />
                站点URL： <br />
                <input name="host_url"  type="text" size="38" />
                <br />
                站点名称： <br />
                <input name="host_name"  type="text" size="38" /><br />
                内容摘要：<br />
                <textarea name="excerpt" rows="10" cols="38"></textarea>
                <br />
                <br />
                <input name="submitBtn" type="button" onclick="saveTrack()" value="&nbsp;&nbsp;提 交&nbsp;&nbsp;"  />
                <input  type="button" onclick="history.back()" value="&nbsp;&nbsp;后 退&nbsp;&nbsp;"  /> 
                <input  type="button" onclick="document.location.href='index.asp?blog_id=<%=blogCatObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=request("pageno")%>'" value="&nbsp;&nbsp;返 回&nbsp;&nbsp;"  />
            </form>        
            </div>
<%
end if
%>            
-->
            <p>&nbsp;</p>
        </div><!--end of content-->
        
</DIV>    
</center>    
</BODY>
</HTML>

<!--#include file="../../inc/end.asp" -->